let timers = {};

self.onmessage = (e) => {

	// 添加新的定时器
	if (e.data.command == 'start') {
		timers[e.data.id] = setInterval(() => {
			self.postMessage({
				id: e.data.id
			});
		}, e.data.interval);
	}

	// 移除定时器
	if (e.data.command == 'stop') {
		clearInterval(timers[e.data.id]);
		delete timers[e.data.id];
	}

}